package cn.iocoder.yudao.module.reading.controller.app.record.vo;

import cn.iocoder.yudao.module.reading.framework.vo.BaseUrlConvertVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 最近阅读 Response VO
 *
 * @author 芋道源码
 */
@Schema(description = "用户 APP - 最近阅读 Response VO")
@Data
@EqualsAndHashCode(callSuper = false)
public class RecentReadingRespVO extends BaseUrlConvertVO {

    @Schema(description = "绘本集ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long bookSetId;

    @Schema(description = "绘本集标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "牛津树1级")
    private String bookSetTitle;

    @Schema(description = "封面图片URL", example = "https://example.com/cover.jpg")
    private String cover;

    @Schema(description = "绘本数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
    private Integer bookCount;

    @Schema(description = "来源标签", example = "经典绘本")
    private String source;

    @Schema(description = "最后阅读时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024-01-05T10:30:00")
    private LocalDateTime lastReadAt;

    @Schema(description = "阅读进度", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.6")
    private Double readProgress;

    @Schema(description = "已读绘本数", example = "12")
    private Integer readBookCount;

    /**
     * 转换URL字段
     * 将相对路径转换为完整URL
     */
    @Override
    public void convertUrls() {
        this.cover = convertUrl(this.cover);
    }
}
